package com.lct.simpleforecast.bean

/**
 * Author：SkySmile
 * Date：2018/7/11
 * Description：从服务器请求的天气预报数据格式
 */

data class ForecastBean(
        val HeWeather6: List<HeWeather>
) {
    fun status() = HeWeather6[0].status
    fun dailyForecastList() = HeWeather6[0].daily_forecast

    data class HeWeather(
            val basic: Basic,
            val update: Update,
            val status: String,
            val daily_forecast: List<DailyForecast>
    ) {
        data class DailyForecast(
                val cond_code_d: String,
                val cond_code_n: String,
                val cond_txt_d: String,
                val cond_txt_n: String,
                val date: String,
                val hum: String,
                val mr: String,
                val ms: String,
                val pcpn: String,
                val pop: String,
                val pres: String,
                val sr: String,
                val ss: String,
                val tmp_max: String,
                val tmp_min: String,
                val uv_index: String,
                val vis: String,
                val wind_deg: String,
                val wind_dir: String,
                val wind_sc: String,
                val wind_spd: String
        ) {
            fun iconUrl(): String = "https://cdn.heweather.com/cond_icon/$cond_code_d.png"
        }

        data class Basic(
                val cid: String,
                val location: String,
                val parent_city: String,
                val admin_area: String,
                val cnty: String,
                val lat: String,
                val lon: String,
                val tz: String
        )

        data class Update(
                val loc: String,
                val utc: String
        )
    }
}